package DMSXL._2023Before.HashTable;

/*public class fourSumCount_ {
    public static void main(String[] args) {
        int[] nums1 = {0};
        int[] nums2 = {0};
        int[] nums3 = {0};
        int[] nums4 = {0};
        Solution solution = new Solution();
        int count = solution.fourSumCount(nums1,nums2,nums3,nums4);
        System.out.println(count);
    }
}
class Solution {
    public int fourSumCount(int[] nums1, int[] nums2, int[] nums3, int[] nums4) {
        HashMap<Integer, Integer> HashMap = new HashMap<>();
        for (int i = 0; i < nums1.length; i++) {
            for (int j = 0; j < nums2.length; j++) {
                if (HashMap.containsKey(nums1[i] + nums2[j])){
                    HashMap.put(nums1[i] + nums2[j],HashMap.get(nums1[i] + nums2[j])+1);
                }
                else {
                    HashMap.put(nums1[i] + nums2[j],1);
                }
            }
        }

        int count = 0;
        for (int i = 0; i < nums3.length; i++) {
            for (int j = 0; j < nums4.length; j++) {
                if(HashMap.containsKey(-(nums3[i] + nums4[j]))){
                    count += HashMap.get(-(nums3[i] + nums4[j]));
                }
            }
        }

        return count;
    }
}*/